//
//  VehicleDataEditViewController.m
//  HondaPro_2
//
//  Created by ht on 13-6-24.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "VehicleDataEditViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "HelpClass.h"
#import "SVProgressHUD.h"
#import "webConfig.h"
#import "webService.h"
#import "NewCarInformationViewController.h"
@interface VehicleDataEditViewController ()

@end

@implementation VehicleDataEditViewController
//@synthesize customertableview = _customertableview;

@synthesize deletebutton = _deletebutton;
@synthesize savebutton = _savebutton;
@synthesize toviewbutton = _toviewbutton;
@synthesize changesbutton = _changesbutton;
@synthesize databutton = _databutton;

@synthesize previewlabel1 = _previewlabel1;
@synthesize previewlabel2 = _previewlabel2;
@synthesize previewlabel3 = _previewlabel3;
@synthesize previewlabel4 = _previewlabel4;
@synthesize previewlabel5 = _previewlabel5;
@synthesize previewlabel6 = _previewlabel6;
@synthesize previewlabel7 = _previewlabel7;
@synthesize previewlabel8 = _previewlabel8;
@synthesize previewlabel9 = _previewlabel9;
@synthesize previewlabel10 = _previewlabel10;
@synthesize previewlabel11 = _previewlabel11;
@synthesize previewlabel12 = _previewlabel12;
@synthesize previewlabel13 = _previewlabel13;
@synthesize previewlabel14 = _previewlabel14;
@synthesize previewlabel15 = _previewlabel15;
@synthesize previewlabel16 = _previewlabel16;
@synthesize previewlabel17 = _previewlabel17;
@synthesize previewlabel18 = _previewlabel18;
@synthesize previewlabel19 = _previewlabel19;
@synthesize previewlabel20 = _previewlabel20;
@synthesize previewlabel21 = _previewlabel21;
@synthesize previewlabel22 = _previewlabel22;
@synthesize previewlabel23 = _previewlabel23;
@synthesize previewlabel24 = _previewlabel24;

@synthesize vehicleBianji = _vehicleBianji;
@synthesize vehicleShanchu = _vehicleShanchu;

@synthesize vehicleDictionary = _vehicleDictionary;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
//        [self addNotification];

    }
    return self;
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
//    //内装颜色
//    webService *web=[[webService alloc] init];
//    web.methodName = GETCARINNERCOLORLIST;
//    [web commonGetSharedRequest:GETCARINNERCOLORLIST wsparas:nil];
//    //车辆颜色
//    webService *web2=[[webService alloc] init];
//    web2.methodName = GETCARCOLORLIST;
//    [web2 commonGetSharedRequest:GETCARCOLORLIST wsparas:nil];
//    //车型列表
//    webService *web3=[[webService alloc] init];
//    web3.methodName = GETCARTYPENAMELIST;
//    [web3 commonGetSharedRequest:GETCARTYPENAMELIST wsparas:nil];
}

-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
    //
//    [self removeNotification];
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    //通用代码表的字典
    self.dicTmp = [HelpClass returnTheDataByJsonFileAndJustForTestWithFileName:@"codeA" andType:@"json"];
    
    [self loadfixedPicture];
    [self loadNewTitleLabelPicture];
    
//    self.customertableview = [[UITableView alloc]initWithFrame:CGRectMake(65, 615, 897, 135) style:UITableViewStylePlain];
//    [self.customertableview setScrollEnabled:NO];
//    [self.customertableview setDataSource:self];
//    [self.customertableview setDelegate:self];
//    [self.view addSubview:self.customertableview];
//    //表格数据的数组
//    self.vehicleDataArray = [NSMutableArray arrayWithArray:[self.vehicleDictionary objectForKey:@"customerList"]];
//
//    //接收编辑页面的通知
//    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(receive:) name:@"carModifyDataDit" object:self.carModifyEditorViewController.carModifyDataDit];
    
    [self loadlabelPicture];
}
//-(void)receive:(NSNotification *)notification
//{
//    self.vehicleDictionary = self.carModifyEditorViewController.carModifyDataDit;
//    //给车主驾驶员列表数组赋值
//    self.vehicleDataArray = [self.vehicleDictionary objectForKey:@"customerList"];
//    NSLog(@"***************%@",self.vehicleDictionary);
//    [self loadText];
//}
////内装颜色
//-(void)getCarInnerColorList:(NSNotification*)notification
//{    
//    self.aInColorDit = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
//    self.aInColorArray = [NSMutableArray arrayWithArray:[self.aInColorDit objectForKey:@"results"]];
//    NSMutableArray *aInColorName = [[NSMutableArray alloc]init];
//    NSMutableArray *aInColorId = [[NSMutableArray alloc]init];
//    for(int i = 0; i<[self.aInColorArray count];i++)
//    {
//        [aInColorName addObject:[[self.aInColorArray objectAtIndex:i] objectForKey:@"carInerColorName"]];
//        [aInColorId addObject:[[self.aInColorArray objectAtIndex:i] objectForKey:@"carInerColorId"]];
//    }
//    if([[self.vehicleDictionary objectForKey:@"insideColor"] rangeOfString:@" "].location)
//    {
//        if([aInColorId containsObject:[self.vehicleDictionary objectForKey:@"insideColor"]])
//        {
//            NSString *aInText = [aInColorName objectAtIndex:[aInColorId indexOfObject:[self.vehicleDictionary objectForKey:@"insideColor"]]];
//            self.previewlabel10.text = aInText;
//        }
//    }
//}
//
////车辆颜色
//-(void)getcarColorList:(NSNotification*)notification
//{
//    NSDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
//    self.carColorArray = [theJson objectForKey:@"results"];
//    NSMutableArray *carColorName = [[NSMutableArray alloc]init];
//    NSMutableArray *carColorId = [[NSMutableArray alloc]init];
//    for(int i = 0; i<[self.carColorArray count];i++)
//    {
//        [carColorName addObject:[[self.carColorArray objectAtIndex:i] objectForKey:@"carColorName"]];
//        [carColorId addObject:[[self.carColorArray objectAtIndex:i] objectForKey:@"carColorId"]];
//    }
//    if([[self.vehicleDictionary objectForKey:@"carColor"] rangeOfString:@" "].location)
//    {
//        if([carColorId containsObject:[self.vehicleDictionary objectForKey:@"carColor"]])
//        {
//            NSString *carColorText = [carColorName objectAtIndex:[carColorId indexOfObject:[self.vehicleDictionary objectForKey:@"carColor"]]];
//            self.previewlabel11.text = carColorText;
//        }
//    }
//
//}
//车型
//-(void)getCarType:(NSNotification*)notification
//{
//    NSDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
//    self.carTypeArray = [theJson objectForKey:@"results"];
//    NSMutableArray *carTypeName = [[NSMutableArray alloc]init];
//    NSMutableArray *carTypeId = [[NSMutableArray alloc]init];
//    for(int i = 0; i<[self.carTypeArray count];i++)
//    {
//        [carTypeName addObject:[[self.carTypeArray objectAtIndex:i] objectForKey:@"carTypeName"]];
//        [carTypeId addObject:[[self.carTypeArray objectAtIndex:i] objectForKey:@"carTypeId"]];
//    }
//    if([carTypeId containsObject:[self.vehicleDictionary objectForKey:@"carType"]])
//    {
//        NSString *carTypeText = [carTypeName objectAtIndex:[carTypeId indexOfObject:[self.vehicleDictionary objectForKey:@"carType"]]];
//        self.previewlabel4.text = carTypeText;
//    }
//}
//-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//{
//    return 1;
//}
//-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//{
//    return [self.vehicleDataArray count];
//}
//-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    NSInteger row = [indexPath row];
//    if(tableView == self.customertableview)
//    {
//        static NSString *indetfire = @"cell";
//        VehicleKeHuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indetfire];
//        if(nil == self.vehicleKeHuTableViewCell)
//        {
//            cell = [[VehicleKeHuTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indetfire];
//            tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
//        }
//        cell.cellLabelOne.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"customerRole"];
//        cell.cellLabelTwo.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"customerId"];
//        cell.cellLabelThree.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"customerName"];
//        if ([[[self.vehicleDataArray objectAtIndex:row]objectForKey:@"natureName"] isEqual:@"C1"]) {
//            cell.cellLabelFour.text=@"政府机关";
//        }else if ([[[self.vehicleDataArray objectAtIndex:row]objectForKey:@"natureName"] isEqual:@"C2"]){
//            cell.cellLabelFour.text=@"企事业单位";
//        }else if ([[[self.vehicleDataArray objectAtIndex:row]objectForKey:@"natureName"] isEqual:@"C3"]){
//            cell.cellLabelFour.text=@"私人";
//        }
//       // cell.cellLabelFour.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"natureName"];
//        cell.cellLabelFive.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"mobile"];
//        cell.cellLabelSix.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"tel"];
//        cell.cellLabelSeven.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"fax"];
//        cell.cellLabelEight.text = [[self.vehicleDataArray objectAtIndex:row]objectForKey:@"address"];
//        return cell;
//    }
//    
//    return 0;
//}
//-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    return 45;
//}
//-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    cell.selectionStyle = UITableViewCellSelectionStyleNone;;
//    if(indexPath.row%2 == 1)
//    {
//        cell.backgroundColor = [[UIColor alloc]initWithRed:0.96 green:0.96 blue:0.96 alpha:1];
//    }
//    else
//    {
//        cell.backgroundColor = [[UIColor alloc]initWithRed:226.00/255 green:226.00/255 blue:226.00/255 alpha:1];
//    }
//    cell.selectionStyle = UITableViewCellSelectionStyleNone;
//}
#pragma mark - 返回按钮的回调
-(void)VehicleBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
//    [self removeNotification];
}
-(void)loadfixedPicture
{
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setImage:[UIImage imageNamed:@"返回.png"] forState:UIControlStateNormal];
    [backButton setFrame:CGRectMake(70, 35, 45, 60)];
    [backButton addTarget:self action:@selector(VehicleBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(20, 105, 1000, 11)];
    image.image = [UIImage imageNamed:@"渐变分割线.png"];
    [self.view addSubview:image];
    UILabel *imagetitel = [[UILabel alloc]initWithFrame:CGRectMake(160, 55, 180, 35)];
    imagetitel.text = @"车辆详细信息";
    imagetitel.backgroundColor = [UIColor clearColor];
    imagetitel.textColor = [UIColor grayColor];
    imagetitel.font = [UIFont fontWithName:@"ArialMT" size:29];
    [self.view addSubview:imagetitel];
    
//    UILabel *remark = [[UILabel alloc]initWithFrame:CGRectMake(70, 457, 140, 25)];
//    [remark setBackgroundColor:[UIColor clearColor]];
//    remark.text = @"   重要提示:";
//    remark.textColor = [UIColor grayColor];
//    remark.font = [UIFont fontWithName:@"ArialMT" size:15];
//    [self.view addSubview:remark];
    
//    UILabel *importantNotice = [[UILabel alloc]initWithFrame:CGRectMake(70, 498-42, 140, 25)];
//    [importantNotice setBackgroundColor:[UIColor clearColor]];
//    importantNotice.text = @"      备   注:";
//    importantNotice.textColor = [UIColor grayColor];
//    importantNotice.font = [UIFont fontWithName:@"ArialMT" size:15];
//    [self.view addSubview:importantNotice];
//    ,@"   生产厂家:" ,@"   重要提示:"
    NSMutableArray *labelMutabelArray = [[NSMutableArray alloc]initWithObjects:@"     车 架 号:",@"     车 牌 号:",@"       型   号:",@"   发动机号:",@"   变速箱号:",@"       年   款:",@"     排 气 量:",@"       备   注:", nil];
    for(int i = 0; i < 8;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(70, (132+i*45), 100, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        //[titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.view addSubview:titlelabel];
    }
//    ,@"国家代码:" ,@"保修序号:",@"保修月数:"
    NSMutableArray *labelMutabelArray1 = [[NSMutableArray alloc]initWithObjects:@"内装颜色:",@"车辆颜色:",@"车系",@"钥  匙  号:",@"车辆用途:", nil];
    for(int i = 0; i < 5;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(360, (132+i*45), 100, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray1 objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        //[titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.view addSubview:titlelabel];
    }
//    UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(348, 447, 140, 25)];
//    [titlelabel setBackgroundColor:[UIColor clearColor]];
//    titlelabel.text = @"变速箱类型:";
//    titlelabel.textColor = [UIColor grayColor];
//    titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
//    [self.view addSubview:titlelabel];
    
//    ,@"      年检开始日期:"
    NSMutableArray *labelMutabelArray2 = [[NSMutableArray alloc]initWithObjects:@"       保  险  公  司:",@"      保险购买日期:",@"      保险到期日期:",@"       购  买  日  期:",@"       上  牌  日  期:",@"   第一次来厂日期:",@"最后一次来厂里程:", nil];
    for(int i = 0; i < 7;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(630, (132+i*45), 140, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray2 objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        //[titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.view addSubview:titlelabel];
    }
    
}
//-(void)loadText
//{
//    self.previewlabel1.text = [self.vehicleDictionary valueForKey:@"vin"];
//    
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"01"])
//    {
//        self.previewlabel2.text = @"[01] 广汽乘用车";
//    }
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"02"])
//    {
//        self.previewlabel2.text = @"[02] 其他";
//    }
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"03"])
//    {
//        self.previewlabel2.text = @"[03] ";
//    }
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"99"])
//    {
//        self.previewlabel2.text = @"[99] 其他厂家";
//    }
//    
//    self.previewlabel3.text = [self.vehicleDictionary valueForKey:@"plateNumber"];
//    self.previewlabel4.text = [self.vehicleDictionary valueForKey:@"carType"];
//    self.previewlabel5.text = [self.vehicleDictionary valueForKey:@"engineNumber"];
//    self.previewlabel6.text = [self.vehicleDictionary valueForKey:@"gearBoxNumber"];
//    self.previewlabel7.text = [self.vehicleDictionary valueForKey:@"year"];
//    self.previewlabel8.text = [self.vehicleDictionary valueForKey:@"emission"];
//    self.previewlabel9.text = [self.vehicleDictionary valueForKey:@"gearBoxNumbe"];
//    
//    self.previewlabel10.text = [self.vehicleDictionary valueForKey:@"insideColor"];
//    self.previewlabel11.text = [self.vehicleDictionary valueForKey:@"carColor"];
//    self.previewlabel12.text = [self.vehicleDictionary valueForKey:@"keyNumber"];
//    self.previewlabel13.text = [self.vehicleDictionary valueForKey:@"countryCode"];
//
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"1"])
//    {
//        self.previewlabel14.text = @"上下班";
//    }
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"2"])
//    {
//        self.previewlabel14.text = @"公事";
//    }
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"3"])
//    {
//        self.previewlabel14.text = @"休闲";
//    }
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"0"])
//    {
//        self.previewlabel14.text = @"其他";
//    }
//    self.previewlabel15.text = [self.vehicleDictionary valueForKey:@"warrantyNumber"];
//    self.previewlabel16.text = [self.vehicleDictionary valueForKey:@"warrantyMonths"];
//    self.previewlabel17.text = [self.vehicleDictionary valueForKey:@"insuranceCompany"];
//    self.previewlabel18.text = [self.vehicleDictionary valueForKey:@"insuranceBuyDate"];
//    self.previewlabel19.text = [self.vehicleDictionary valueForKey:@"insuranceExpiresDate"];
//    self.previewlabel20.text = [self.vehicleDictionary valueForKey:@"yearCheckStartDate"];
//    self.previewlabel21.text = [self.vehicleDictionary valueForKey:@"buyDate"];
//    self.previewlabel22.text = [self.vehicleDictionary valueForKey:@"plateDate"];
//    self.previewlabel23.text = [self.vehicleDictionary valueForKey:@"firstComingDate"];
//    self.previewlabel24.text = [self.vehicleDictionary valueForKey:@"lastComingMileage"];
//    self.previewlabel25.text = [self.vehicleDictionary valueForKey:@"importantNotice"];
//    self.previewlabel26.text = [self.vehicleDictionary valueForKey:@"remark"];
//    
////    [self.customertableview reloadData];
//}
-(void)loadlabelPicture
{
    self.previewlabel1 = [[UILabel alloc]initWithFrame:CGRectMake(160, 130, 170, 30)];//车架号
    [self.previewlabel1 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel1.textColor = [UIColor grayColor];
    self.previewlabel1.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel1.text = _cjhStr;
    [self.view addSubview:self.previewlabel1];
    
//    self.previewlabel2 = [[UILabel alloc]initWithFrame:CGRectMake(160, 175, 120, 30)];//生产厂家
//    [self.previewlabel2 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel2.textColor = [UIColor grayColor];
//    self.previewlabel2.font = [UIFont fontWithName:@"ArialMT" size:15];
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"01"])
//    {
//        self.previewlabel2.text = @"[01] 广汽乘用车";
//    }
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"02"])
//    {
//        self.previewlabel2.text = @"[02] 其他";
//    }
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"03"])
//    {
//        self.previewlabel2.text = @"[03] ";
//    }
//    if([[self.vehicleDictionary objectForKey:@"manufactureName"]isEqualToString:@"99"])
//    {
//        self.previewlabel2.text = @"[99] 其他厂家";
//    }
//    [self.view addSubview:self.previewlabel2];
    
    self.previewlabel3 = [[UILabel alloc]initWithFrame:CGRectMake(160, 220-45, 120, 30)];//车牌号
    [self.previewlabel3 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel3.textColor = [UIColor grayColor];
    self.previewlabel3.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel3.text = _cphStr;
    [self.view addSubview:self.previewlabel3];
    
    self.previewlabel4 = [[UILabel alloc]initWithFrame:CGRectMake(160, 265-45, 120, 30)];//车型号
    [self.previewlabel4 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel4.textColor = [UIColor grayColor];
    self.previewlabel4.font = [UIFont fontWithName:@"ArialMT" size:15];

    self.previewlabel4.text = _xhStr;
    [self.view addSubview:self.previewlabel4];
    
    self.previewlabel5 = [[UILabel alloc]initWithFrame:CGRectMake(160, 310-45, 120, 30)];//发动机号
    [self.previewlabel5 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel5.textColor = [UIColor grayColor];
    self.previewlabel5.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel5.text = _fdjhStr;
    [self.view addSubview:self.previewlabel5];
    
    self.previewlabel6 = [[UILabel alloc]initWithFrame:CGRectMake(160, 355-45, 120, 30)];//变速箱号
    [self.previewlabel6 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel6.textColor = [UIColor grayColor];
    self.previewlabel6.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel6.text = _bsxhStr;
    [self.view addSubview:self.previewlabel6];
    
    self.previewlabel7 = [[UILabel alloc]initWithFrame:CGRectMake(160, 400-45, 120, 30)];//年款
    [self.previewlabel7 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel7.textColor = [UIColor grayColor];
    self.previewlabel7.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel7.text = _nkStr;
    [self.view addSubview:self.previewlabel7];
    
    self.previewlabel8 = [[UILabel alloc]initWithFrame:CGRectMake(160, 445-45, 120, 30)];//排气量
    [self.previewlabel8 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel8.textColor = [UIColor grayColor];
    self.previewlabel8.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel8.text = _pqlStr;
    [self.view addSubview:self.previewlabel8];
    
//    self.previewlabel25 = [[UILabel alloc]initWithFrame:CGRectMake(160, 490, 750, 30)];//重要提示
//    [self.previewlabel25 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel25.textColor = [UIColor grayColor];
//    self.previewlabel25.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel25.text = [self.vehicleDictionary valueForKey:@"importantNotice"];
//    [self.view addSubview:self.previewlabel25];
    
    self.previewlabel26 = [[UILabel alloc]initWithFrame:CGRectMake(160, 535-45-45, 750, 30)];//备注
    [self.previewlabel26 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel26.textColor = [UIColor grayColor];
    self.previewlabel26.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel26.text = _bzStr;
    [self.view addSubview:self.previewlabel26];
    
//    self.previewlabel9 = [[UILabel alloc]initWithFrame:CGRectMake(440, 445, 120, 30)];//变速箱类型
//    [self.previewlabel9 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel9.textColor = [UIColor grayColor];
//    self.previewlabel9.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel9.text = [self.vehicleDictionary valueForKey:@"gearBoxType"];
//    [self.view addSubview:self.previewlabel9];

    //内装颜色
    self.previewlabel10 = [[UILabel alloc]initWithFrame:CGRectMake(440, 130, 130, 30)];//内装颜色
    [self.previewlabel10 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel10.textColor = [UIColor grayColor];
    self.previewlabel10.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel10.text = _nzysStr;
    [self.view addSubview:self.previewlabel10];
    
    self.previewlabel11 = [[UILabel alloc]initWithFrame:CGRectMake(440, 175, 130, 30)];//车辆颜色
    [self.previewlabel11 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel11.textColor = [UIColor grayColor];
    self.previewlabel11.font = [UIFont fontWithName:@"ArialMT" size:15];
   self.previewlabel11.text = _ClysStr;
    [self.view addSubview:self.previewlabel11];
    
    UILabel * chexiLabel = [[UILabel alloc]initWithFrame:CGRectMake(440, 220, 160, 30)];//钥匙号
    [chexiLabel setBackgroundColor:[UIColor clearColor]];
    chexiLabel.textColor = [UIColor grayColor];
    chexiLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    chexiLabel.text = _cxStr;
    [self.view addSubview:chexiLabel];
    
    self.previewlabel12 = [[UILabel alloc]initWithFrame:CGRectMake(440, 220+45, 160, 30)];//钥匙号
    [self.previewlabel12 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel12.textColor = [UIColor grayColor];
    self.previewlabel12.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel12.text = _yshStr;
    [self.view addSubview:self.previewlabel12];
    
//    self.previewlabel13 = [[UILabel alloc]initWithFrame:CGRectMake(440, 265, 160, 30)];//国家代码
//    [self.previewlabel13 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel13.textColor = [UIColor grayColor];
//    self.previewlabel13.font = [UIFont fontWithName:@"ArialMT" size:15];
//    if([[self.vehicleDictionary valueForKey:@"countryCode"] isEqualToString:@"CHN"])
//    {
//        self.previewlabel13.text = @"CHN";
//    }
//    if([[self.vehicleDictionary valueForKey:@"countryCode"] isEqualToString:@"JPN"])
//    {
//        self.previewlabel13.text = @"JPN";
//    }
//    [self.view addSubview:self.previewlabel13];
    
    
    self.previewlabel14 = [[UILabel alloc]initWithFrame:CGRectMake(440, 310, 160, 30)];//车辆用途
    [self.previewlabel14 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel14.textColor = [UIColor grayColor];
    self.previewlabel14.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel14.text = _clytStr;
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"1"])
//    {
//        self.previewlabel14.text = @"上下班";
//    }
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"2"])
//    {
//        self.previewlabel14.text = @"公事";
//    }
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"3"])
//    {
//        self.previewlabel14.text = @"休闲";
//    }
//    if([[self.vehicleDictionary objectForKey:@"carUse"]isEqualToString:@"0"])
//    {
//        self.previewlabel14.text = @"其他";
//    }
    [self.view addSubview:self.previewlabel14];
    
//    self.previewlabel15 = [[UILabel alloc]initWithFrame:CGRectMake(440, 355, 160, 30)];//保修序号
//    [self.previewlabel15 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel15.textColor = [UIColor grayColor];
//    self.previewlabel15.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel15.text = [self.vehicleDictionary valueForKey:@"warrantyNumber"];
//    [self.view addSubview:self.previewlabel15];
//    
//    self.previewlabel16 = [[UILabel alloc]initWithFrame:CGRectMake(440, 400, 160, 30)];//保修月数
//    [self.previewlabel16 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel16.textColor = [UIColor grayColor];
//    self.previewlabel16.font = [UIFont fontWithName:@"ArialMT" size:15];
//    
//    self.previewlabel16.text = [self.vehicleDictionary valueForKey:@"warrantyMonths"];
//    [self.view addSubview:self.previewlabel16];
    
    self.previewlabel17 = [[UILabel alloc]initWithFrame:CGRectMake(765, 130, 160, 30)];//保险公司
    [self.previewlabel17 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel17.textColor = [UIColor grayColor];
    self.previewlabel17.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel17.text = _bxgsStr;
    [self.view addSubview:self.previewlabel17];
    
    self.previewlabel18 = [[UILabel alloc]initWithFrame:CGRectMake(765, 175, 160, 30)];//保险购买日期
    [self.previewlabel18 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel18.textColor = [UIColor grayColor];
    self.previewlabel18.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel18.text = _bxgmrqStr;
    [self.view addSubview:self.previewlabel18];
    
    self.previewlabel19 = [[UILabel alloc]initWithFrame:CGRectMake(765, 220, 160, 30)];//保险到期日期
    [self.previewlabel19 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel19.textColor = [UIColor grayColor];
    self.previewlabel19.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel19.text = _bxdqrqStr;
    [self.view addSubview:self.previewlabel19];
    
//    self.previewlabel20 = [[UILabel alloc]initWithFrame:CGRectMake(765, 265, 160, 30)];//年检开始日期
//    [self.previewlabel20 setBackgroundColor:[UIColor clearColor]];
//    self.previewlabel20.textColor = [UIColor grayColor];
//    self.previewlabel20.font = [UIFont fontWithName:@"ArialMT" size:15];
//    self.previewlabel20.text = [self.vehicleDictionary valueForKey:@"yearCheckStartDate"];
//    [self.view addSubview:self.previewlabel20];
    
    self.previewlabel21 = [[UILabel alloc]initWithFrame:CGRectMake(765, 310-45, 160, 30)];//购买日期
    [self.previewlabel21 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel21.textColor = [UIColor grayColor];
    self.previewlabel21.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel21.text = _gmrqStr;
    [self.view addSubview:self.previewlabel21];
    
    self.previewlabel22 = [[UILabel alloc]initWithFrame:CGRectMake(765, 355-45, 160, 30)];//上牌日期
    [self.previewlabel22 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel22.textColor = [UIColor grayColor];
    self.previewlabel22.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel22.text = _sprqStr;
    [self.view addSubview:self.previewlabel22];
    
    self.previewlabel23 = [[UILabel alloc]initWithFrame:CGRectMake(765, 400-45, 160, 30)];//第一次来厂日期
    [self.previewlabel23 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel23.textColor = [UIColor grayColor];
    self.previewlabel23.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel23.text = _dyclcrqStr;
    [self.view addSubview:self.previewlabel23];
    
    self.previewlabel24 = [[UILabel alloc]initWithFrame:CGRectMake(765, 445-45, 160, 30)];//最后一次来厂里程
    [self.previewlabel24 setBackgroundColor:[UIColor clearColor]];
    self.previewlabel24.textColor = [UIColor grayColor];
    self.previewlabel24.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.previewlabel24.text = _zhyclclcStr;
    [self.view addSubview:self.previewlabel24];
#pragma mark - 编辑按钮
    self.vehicleBianji = [[UIButton alloc]initWithFrame:CGRectMake(840, 60, 80, 36)];
    [self.vehicleBianji setTitle:@"编 辑" forState:UIControlStateNormal];
    [self.vehicleBianji setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.vehicleBianji setBackgroundImage:[UIImage imageNamed:@"改-灰but.png"] forState:UIControlStateNormal];
    [self.vehicleBianji addTarget:self action:@selector(vehicleBianji:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.vehicleBianji];
}
#pragma mark - 编辑按钮的回调
-(void)vehicleBianji:(id)sender
{
    NewCarInformationViewController * vc = [[NewCarInformationViewController alloc]init];
    vc.CLFlag = @"cl";
    vc.cjhStr = _cjhStr;
    vc.cphStr = _cphStr;
    vc.xhStr = _xhStr;
    vc.cxStr = _cxStr;
    vc.fdjhStr = _fdjhStr;
    vc.bsxhStr = _bsxhStr;
    vc.nkStr = _nkStr;
    vc.pqlStr = _pqlStr;
    vc.bzStr = _bzStr;
    vc.nzysStr = _nzysStr;
    vc.ClysStr = _ClysStr;
    vc.yshStr = _yshStr;
    vc.clytStr = _clytStr;
    vc.bxgsStr = _bxgsStr;
    vc.bxgmrqStr = _bxgmrqStr;
    vc.bxdqrqStr = _bxdqrqStr;
    vc.gmrqStr = _gmrqStr;
    vc.sprqStr = _sprqStr;
    vc.dyclcrqStr = _dyclcrqStr;
    vc.zhyclclcStr = _zhyclclcStr;
    
    vc.khbhStr = _khbhStr;
    vc.khmcStr = _khmcStr;
    vc.khxzStr = _khxzStr;
    vc.sjStr = _sjStr;
    vc.lxdhStr = _lxdhStr;
    vc.lxrStr = _lxrStr;
    vc.lxdzStr = _lxdzStr;
    [self.navigationController pushViewController:vc animated:YES];
    
    
//    self.carModifyEditorViewController = [[CarModifyEditorViewController alloc]init];
//    //内装颜色和车辆的颜色传过去用来对比转换
//    self.carModifyEditorViewController.neiZhuangColorArray = self.aInColorArray;
//    self.carModifyEditorViewController.cheLiangColorArray = self.carColorArray;
//    self.carModifyEditorViewController.carTypeArray = self.carTypeArray;
//    //详情的字典传过去用来显示
//    self.carModifyEditorViewController.carModifyDataDit = self.vehicleDictionary;
//    NSMutableDictionary *bianjiDit = [NSMutableDictionary dictionaryWithDictionary:self.vehicleDictionary];
//    if(self.previewlabel10.text != nil)
//    {
//        [bianjiDit setObject:self.previewlabel10.text forKey:@"insideColor"];
//    }
//    if(self.previewlabel11.text != nil)
//    {
//        [bianjiDit setObject:self.previewlabel11.text forKey:@"carColor"];
//    }
//    [bianjiDit setObject:self.previewlabel4.text forKey:@"carType"];
//    self.carModifyEditorViewController.carModifyDataDit = bianjiDit;
//    [self.navigationController pushViewController:self.carModifyEditorViewController animated:YES];
//    [self removeNotification];
}
-(void)loadNewTitleLabelPicture
{
    NSMutableArray *labelMutabelArray = [[NSMutableArray alloc]initWithObjects:@"客户",@"客户编号",@"客户名称",@"客户性质",@"手机",@"联系电话",@"联系人",@"联系地址", nil];
    for(int i = 0; i < 8;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake((65+i*112), 575, 113, 40)];
        [titlelabel setBackgroundColor:[[UIColor alloc]initWithRed:240.00/255 green:240.00/255 blue:240.00/255 alpha:1]];
        titlelabel.text = [labelMutabelArray objectAtIndex:i];
        [titlelabel setTextColor:[UIColor grayColor]];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:16];
        [titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.view addSubview:titlelabel];
    }
    //客户
    self.kehuLabel = [[UILabel alloc]initWithFrame:CGRectMake((65), 575+45, 113, 40)];
    self.kehuLabel.text = @"车主";
    self.kehuLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [self.kehuLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:self.kehuLabel];
    
    //客户编号
    self.ownerNoLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+1*112), 575+45, 113, 40)];
    self.ownerNoLabel.text = _khbhStr;
    self.ownerNoLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [self.ownerNoLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:self.ownerNoLabel];
    //客户名称
    UILabel * khmcLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+2*112), 575+45, 113, 40)];
    khmcLabel.text = _khmcStr;
    khmcLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [khmcLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:khmcLabel];
//    客户性质
    UILabel * khxzLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+3*112), 575+45, 113, 40)];
    khxzLabel.text = _khxzStr;
    khxzLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [khxzLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:khxzLabel];
//    手机
    UILabel * sjLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+4*112), 575+45, 113, 40)];
    sjLabel.text = _sjStr;
    sjLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [sjLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:sjLabel];
//    联系电话
    UILabel * lxdhLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+5*112), 575+45, 113, 40)];
    lxdhLabel.text = _lxdhStr;
    lxdhLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [lxdhLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:lxdhLabel];
//    联系人
    UILabel * lxrLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+6*112), 575+45, 113, 40)];
    lxrLabel.text = _lxrStr;
    lxrLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [lxrLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:lxrLabel];
//    联系地址
    UILabel * lxdzLabel = [[UILabel alloc]initWithFrame:CGRectMake((65+7*112), 575+45, 113, 40)];
    lxdzLabel.text = _lxdzStr;
    lxdzLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [lxdzLabel setTextAlignment:NSTextAlignmentCenter];
    [self.view addSubview:lxdzLabel];
    
}
//-(void)addNotification
//{
//    //获取内饰颜色列表
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCarInnerColorList:) name:GETCARINNERCOLORLIST object:nil];
//    //获取车辆颜色列表
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getcarColorList:) name:GETCARCOLORLIST object:nil];
//    //获取车型列表
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCarType:) name:GETCARTYPENAMELIST object:nil];
//}
//-(void)removeObserver
//{
//    [[NSNotificationCenter defaultCenter]removeObserver:self name:@"carModifyDataDit" object:nil];
//}
//-(void)removeNotification
//{
//    [[NSNotificationCenter defaultCenter]removeObserver:self];
//}
//- (void)didReceiveMemoryWarning
//{
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}

@end
